<?php

namespace app\model\agent;

use app\model\user\User;
use crmeb\basic\BaseModel;
use crmeb\traits\ModelTrait;

class AgentRelation extends BaseModel
{
    use ModelTrait;

    /**
     * 数据表主键
     * @var string
     */
    protected $pk = 'id';

    /**
     * 模型名称
     * @var string
     */
    protected $name = 'agent_relation';

    public function user()
    {
        return $this->belongsTo(User::class, 'uid', 'uid');
    }

    /**
     *
     * 收益
     *
     * @return \think\model\relation\BelongsTo
     */
    public function behaviourStatistics()
    {
        return $this->belongsTo(AgentBehaviourStatistic::class, 'user_id', 'uid');
    }
}